package com.by.service.impl;

import com.by.bean.Customer;
import com.by.common.crud.BaseServiceImpl;
import com.by.common.utils.Assert;
import com.by.mapper.CustomerMapper;
import com.by.mapper.UserMapper;
import com.by.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CustomerServiceImpl extends BaseServiceImpl<Customer, CustomerMapper> implements CustomerService {

    @Autowired
    UserMapper userMapper;
    @Override
    public int save(Customer entity) {
        //保存用户
        entity.getUser().setType(4);
        int rs = userMapper.save(entity.getUser());
        Assert.isNotSuccess(rs, "用户保存失败");
        //Assert.isNotSuccess(rs, "用户保存失败");
        return super.save(entity);
    }
}
